Determine Whether a Gesture Is Detected
Function:
magicbox.is_ges_detected(port, ges)Description: judge whether a specified gesture is detected
Required parameter:
- port: controller port. data type: int, range: 1~6
- ges: gesture types
| ges | Value | Description |
|---|---|---|
| 1 | magicbox.RIGHT | Right |
| 2 | magicbox.LEFT | Left |
| 4 | magicbox.UP | Up |
| 8 | magicbox.DOWN | Down |
| 16 | magicbox.FORWARD | Forward |
| 32 | magicbox.BACKWARD | Backward |
| 64 | magicbox.CLOCKWISE | Clockwise |
| 128 | magicbox.ANTICLOCKWISE | Anticlockwise |
- Return:
- True: a gesture was detected
- False: a gesture was not detected
Example
res = magicbox.is_ges_detected(port=6, ges=magicbox.UP)Detect the gesture sensor connected to Port 6 of controller, and judge whether the current gesture is up.